<?php

namespace app\common\model;

use app\common\lib\Show;

class CollageCollage extends TimeModel
{

    protected $name = "collage_collage";

    protected $deleteTime = "delete_time";


    public function getStatusList(): array
    {
        return ['0' => '禁用', '1' => '启用',];
    }

    public function getHalfwayList(): array
    {
        return ['0' => '否', '1' => '是',];
    }

    public function getNumberList(): array
    {
        return ['0' => '不限制', '1' => '限制',];
    }

    public function getBargainTypeList(): array
    {
        return ['0' => '分享拼团'];
    }

    /**
     * 设置限定区域
     * @return string[]
     */
    public function getBargainAddressList(): array
    {
        return ['0' => '不限制', '1' => '限制'];
    }

    /**
     * 设置可买 不可买规则
     * @return string[]
     */
    public function getPayTypeList(): array
    {
        return ['0' => '设置可买', '1' => '设置不可买'];
    }

    /**
     * @param $value
     * @return false|string
     */
    protected function getGetStartTimeAttr($value)
    {
        if ($value <= 0) {
            return '';
        } else {
            return date('Y-m-d H:i:s', $value);
        }
    }

    /**
     * @param $value
     * @return false|string
     */
    protected function getGetEndTimeAttr($value)
    {
        if ($value <= 0) {
            return '';
        } else {
            return date('Y-m-d H:i:s', $value);
        }
    }

    /**
     * @param $value
     * @return mixed|string
     */
    public function getGetPayTypeAttr($value)
    {
        $pay_type = config('pay_type');
        $str = "";
        foreach ($pay_type as $v) {
            if ($value == $v['value']) {
                $str = $v['name'];
                break;
            }
        }
        return $str;
    }


}